import React from 'react'

import  HomeHotUI from './HomeHotUI'

import { getHomeHot1,getHomeHot2} from '../../../api/home'


// test测试
// console.log( getHomeHot1())


// let {homehot1Data,homehot2Data}=api.homehot

// console.log(homehot1Data)




export default class HomeHot extends React.Component {

    constructor(props){
        super(props)
        this.state={
            homehot1:[],
            homehot2:[]
        }
    }

    componentDidMount(){
      // 在组件里面调用封装的api请求 尽量不要传递参
        getHomeHot1().then(res=>{
            console.log(res)
            this.setState({
                homehot1:res
            })
        })

        getHomeHot2().then(res=>{
            console.log(res)
            this.setState({
                homehot2:res
            })
        })

      

       

    }



   
    render() {
        let {homehot1 ,homehot2}=this.state
        return (
            <div>
               <HomeHotUI  data={homehot1}   title='男人抢手商品'/> 

               <HomeHotUI   data={homehot2}   title='女人抢手商品'/> 


            </div>

        )
    }
}